import Vue from 'vue'
import Router from 'vue-router'
import Register from './views/Register.vue'
import Botnav from './views/Botnav'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'Register',
      redirect: '/login'
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('./views/Login.vue')
    },
    {
      path: '/index',
      name: 'Index',
      component: () => import('./views/Index.vue')
    },
    {
      path: '/botnav',
      name: 'Botnav',
      component: Botnav,
      children: [
        {
          path: 'index',
          name: 'Index',
          component: () => import('./views/Index.vue')
        }, {
          path: 'list',
          name: 'List',
          component: () => import('./views/List.vue')
        }, {
          path: 'search',
          name: 'Search',
          component: () => import('./views/Search.vue')
        }, {
          path: 'car',
          name: 'Car',
          meta: {
            requireAuth: true    //当为true是必须登陆才能访问
          },
          component: () => import('./views/Car.vue')
        }, {
          path: 'mine',
          name: 'Mine',
          meta: {
            requireAuth: true
          },
          component: () => import('./views/Mine.vue')
        },]
    }
  ]
})
